package fl.ass.service.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cmm.service.core.framework.biz.BaseBizImpl;
import cmm.service.core.framework.dao.IBaseDao;
import cn.cmm.base.framework.exception.BaseException;
import fl.ass.facade.condition.AssTrailCarFlowHistoryQC;
import fl.ass.facade.dto.AssTrailCarFlowHistoryDTO;
import fl.ass.facade.dto.MessageDTO;
import fl.ass.service.dao.AssTrailCarFlowHistoryMapper;
import fl.ass.service.po.AssTrailCarFlowHistory;
import fl.ass.service.service.IAssTrailCarFlowHistoryService;
import fl.ass.service.transform.AssTrailCarFlowHistoryTransform;



/**
 * @Description: 拖车审批流程：财务估算保底价（只读不可修改）
转优车流程：财务核算盈亏（只读不可修改）
拖车赎回流程：财务核算赎回金额、财务确认到账金额时间、财务做账
拖车管理处置流程：财务确认到账、财务做账
优车处置流程：财务确认来款、财务做账
 服务层接口实现
 * @Description: 类中已经实现了简单增删改查操作,可以直接使用,如果有需要重写该方法即可：
 * @Description: 1、add(TVO entity) 2、removeById(Long id) 3、modify(DTO entity) 4、selectById(Long id)	5、searchListPage(Pager page) 7、searchList(DTO dto)   
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Service
public class AssTrailCarFlowHistoryServiceImpl extends BaseBizImpl<AssTrailCarFlowHistory, AssTrailCarFlowHistoryDTO, AssTrailCarFlowHistoryQC> implements IAssTrailCarFlowHistoryService {
	
	@SuppressWarnings("unused")
	private static final Logger logger = LoggerFactory.getLogger(AssTrailCarFlowHistoryServiceImpl.class);
	
	@Autowired
	private AssTrailCarFlowHistoryMapper assTrailCarFlowHistoryMapper;
	
	@Override
	public List<AssTrailCarFlowHistoryDTO> searchList(AssTrailCarFlowHistoryQC condition) throws BaseException {
		if(null == condition) return new ArrayList<AssTrailCarFlowHistoryDTO>();
		List<AssTrailCarFlowHistory> list = this.assTrailCarFlowHistoryMapper.selectList(condition);
		return AssTrailCarFlowHistoryTransform.toDTOList(list);
	}
	
	@Override
	public IBaseDao<AssTrailCarFlowHistory,AssTrailCarFlowHistoryQC> getDao() {
		return this.assTrailCarFlowHistoryMapper;
	}

	@Override
	public MessageDTO<String> updateAssTcF(List<AssTrailCarFlowHistoryDTO> dtos) {
		// TODO 自动生成的方法存根
		assTrailCarFlowHistoryMapper.batchUpdateFlowHistory(dtos);
		return null;
	}

	@Override
	public MessageDTO<String> batchInsert(List<AssTrailCarFlowHistoryDTO> dtos) {
		// TODO 自动生成的方法存根
		assTrailCarFlowHistoryMapper.batchAddFlowHistory(dtos);
		return null;
	}

	@Override
	public MessageDTO<String> insert(AssTrailCarFlowHistoryDTO dto) {
		// TODO 自动生成的方法存根
		super.add(dto);
		return null;
	}

	@Override
	public List<AssTrailCarFlowHistoryDTO> selectList(AssTrailCarFlowHistoryQC qc) {
		// TODO 自动生成的方法存根
		 List<AssTrailCarFlowHistory> flowHistories=assTrailCarFlowHistoryMapper.selectList(qc);
		 List<AssTrailCarFlowHistoryDTO> dtos=new ArrayList<AssTrailCarFlowHistoryDTO>();
		 for(AssTrailCarFlowHistory carFlowHistory:flowHistories){
			 AssTrailCarFlowHistoryDTO dto=AssTrailCarFlowHistoryTransform.toDTO(carFlowHistory);
			 dtos.add(dto);
		 }
		return dtos;
	}

	@Override
	public MessageDTO<String> batchDelete(List<Long> ids) {
		// TODO 自动生成的方法存根
		assTrailCarFlowHistoryMapper.deleteByIds(ids);
		return null;
	}
}

